<?php
/**
 * 将CSDN中的邮箱还到数据库里
 * 
 * 导入完普通电脑需面4个半小时
 */
//exit("处理好");

set_time_limit(0);
$s = microtime(true);
$file_dir = "csdn_email.txt";

$i = 0;
$file = fopen ( $file_dir, "r" );
if(!$file){
	echo "文件打不开或不存在";
	exit;
}

/*连接数据库*/
mysql_select_db("data_center",mysql_connect("localhost","data_center543","69o855o5o5"));
mysql_query("set names utf8");

/*从文件中每次读一行，将Email存入数据库*/
while ( !feof($file) ){
	$email = trim(fgets($file));
	mysql_query("INSERT INTO email_csdn_all (email) VALUES ('".$email."');");
}

fclose($file);
echo "用时:".number_format(microtime(true) - $s, 3, '.', '')."秒";